/**************************************************************************************
* Component of simpleRTJ regression tests.
**************************************************************************************
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL RTJ COMPUTING BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Created by:
*       RTJ Computing
**************************************************************************************/
public class TestSynch
{
    int a = 0;

    public static synchronized void staticSync()
    {
    }

    public static void test() throws Exception
    {
        TestSynch ts = new TestSynch();

        ts.testSync();
        try
        {
            ts.testNoSync();
        } catch(Exception e) {}

        ts.testNoSync2();
        staticSync();
    }

    public synchronized void testSync()
    {
        testNest();
        staticSync();
    }

    public void testNoSync() throws Exception
    {
        testSync2();
    }

    public synchronized void testSync2() throws Exception
    {
        throw new Exception("SYN");
    }
    public void testNoSync2()
    {
        a = 1;
        synchronized(this)
        {
            a = hashCode();
        }
    }

    public synchronized void testNest()
    {
    }
}
